/*
 * Copyright: Copyright (c)2011
 * Company: 易宝支付(YeePay)
 */

package com.cyl.yeepay.gateway.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cyl.manager.oms.service.AftersaleService;
import com.cyl.yeepay.vo.RefundNotifyRetVo;
import com.yeepay.yop.sdk.service.common.callback.YopCallback;

import cn.hutool.json.JSONUtil;

/**
 * 退款成功回调
 * 
 */
@Component
public class YopRefCallbackHandler extends YopBaseCallbackHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(YopRefCallbackHandler.class);

    @Autowired
    private AftersaleService aftersaleService;
    
    @Override
    public String getType() {
        return "/ref/notify";
    }

    @Override
    public void handle(YopCallback callback) {
    	  String json = callback.getBizData();
    	  RefundNotifyRetVo refundNotifyRetVo = JSONUtil.toBean(json, RefundNotifyRetVo.class);
    	   //获取退款回调的信息
          aftersaleService.refundOrderExc(refundNotifyRetVo,json);
           
    }
}